// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import ViewUI from 'view-design'
import i18n from '@/locale'
import config from '@/config'
import { hasOneOf } from '@/libs/tools'
import * as util from '@/libs/util'

import importDirective from '@/directive'
import 'view-design/dist/styles/iview.css'
import './index.less'
import '@/assets/icons/iconfont.css'
import VerticalToggle from '_c/vertical-toggle'
import axios from '@/libs/api.request'
import MessageBox from '@/view/components/dialog'
import HandleBtn from '_c/handle-btn'
import InputUpload from '_c/input-upload'
import Image from '_c/image'
import 'viewerjs/dist/viewer.css'
import Viewer from 'v-viewer'
// import '@/mock'
// 实际打包时应该不引入mock
// import env from '../config/env'
/* eslint-disable */
 // env === 'mock' ? require('@/mock') : ''
Vue.use(MessageBox);
Vue.use(Viewer, {
  defaultOptions: {
      zIndex: 9999
  }
})
Vue.use(ViewUI, {
  i18n: (key, value) => i18n.t(key, value)
})
Vue.config.productionTip = false
/**
 * @description 全局注册应用配置
 */
Vue.prototype.$config = config
Vue.prototype.$http = axios
Vue.prototype.$util = util
Vue.prototype.$_has = function(value){
  value = value.replace(/\s+/g, '')
  return hasOneOf(this.$store.state.user.access, value.split(','))
}
Vue.component('VerticalToggle', VerticalToggle)
Vue.component('HandleBtn', HandleBtn)
Vue.component('InputUpload', InputUpload)
Vue.component('m-image', Image)
/**
 * 注册指令
 */
importDirective(Vue)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  i18n,
  store,
  render: h => h(App)
})
